<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right"><a href="<?php echo $add; ?>" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus"></i></a> <a href="<?php echo $repair; ?>" data-toggle="tooltip" title="<?php echo $button_rebuild; ?>" class="btn btn-default"><i class="fa fa-refresh"></i></a>
      </div>
      <h1><?php echo $heading_title; ?></h1>
      <ul class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
        <?php } ?>
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    <?php if ($error_warning) { ?>
    <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    <?php } ?>
    <?php if ($success) { ?>
    <div class="alert alert-success"><i class="fa fa-check-circle"></i> <?php echo $success; ?>
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    <?php } ?>
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-list"></i> <?php echo $text_list; ?></h3>
      </div>
      <div class="panel-body">
        <div class="well">
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-company_eng_name"><?php echo $column_company_eng_name; ?></label>
                <input type="text" name="filter_company_eng_name" value="<?php echo $filter_company_eng_name; ?>" placeholder="<?php echo $column_company_eng_name; ?>" id="input-company_eng_name" class="form-control" />
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-company_chn_name"><?php echo $column_company_chn_name; ?></label>
                <input type="text" name="filter_company_chn_name" value="<?php echo $filter_company_chn_name; ?>" placeholder="<?php echo $column_company_chn_name; ?>" id="input-company_chn_name" class="form-control" />
              </div>
              <button type="button" id="button-filter" class="btn btn-primary pull-right"><i class="fa fa-search"></i> <?php echo $button_filter; ?></button>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
          <div class="col-sm-6 text-right"><?php echo $results; ?></div>
        </div>
        <form action="<?php echo $delete; ?>" method="post" enctype="multipart/form-data" id="form-category">
          <div class="table-responsive">
            <table class="table table-bordered table-hover">
              <thead style="background-color: #f5f5f5;">
                <tr>
                  <!-- <td class="text-center"><?php echo $column_action; ?></td> -->
                  <td class="text-center" >序號</td>
                  
                  <td class="text-center"><?php echo $column_company_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_company_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_tel; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_email; ?></td>
<<<<<<< HEAD
<<<<<<< HEAD
                  <td class="text-center"><?php echo $column_company_address; ?></td>
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
                  <td class="text-center"><?php echo $column_contact_person_id; ?></td>
                  <td class="text-center"><?php echo $column_company_website; ?></td>
                  <td class="text-center"><?php echo $column_shareholder1_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder1_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder1_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder2_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder2_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder2_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder3_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder3_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder3_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder4_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder4_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder4_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder5_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder5_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder5_id; ?></td>
                  <td class="text-center"><?php echo $column_status; ?></td>
                </tr>
              </thead>
              <tbody>
                <?php if ($customers) { ?>
                <?php foreach ($customers as $key => $customer) { ?>
                <tr <?php if($customer['status'] == 1){ }else{ echo 'style="background-color: #f5f5f5"'; } ?> >
                  <!-- <td class="text-center"><a href="<?php echo $customer['edit']; ?>" data-toggle="tooltip" title="<?php echo $button_edit; ?>" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td> -->
                  <td class="text-center" ><?php echo $key+1; ?></td>
                  
                  <td class="text-center"><a href="<?php echo $customer['edit']; ?>" ><?php echo $customer['company_eng_name']; ?></a></td>
                  <td class="text-center"><a href="<?php echo $customer['edit']; ?>" ><?php echo $customer['company_chn_name']; ?></a></td>
                  <td class="text-center"><?php echo $customer['contact_person_eng_name']; ?></td>
                  <td class="text-center"><?php echo $customer['contact_person_chn_name']; ?></td>
                  <td class="text-center"><?php echo $customer['contact_person_tel']; ?></td>
                  <td class="text-center"><?php echo $customer['contact_person_email']; ?></td>
<<<<<<< HEAD
<<<<<<< HEAD
                  <td class="text-center"><?php echo $customer['company_address']; ?></td>                  
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
                  <td class="text-center">
                    <?php if(!empty($customer['contact_person_id'])){ ?>
                      <?php foreach($customer['contact_person_id'] as $contact_person){ ?>
                        <a target='_blank' style='display: block;height: 100%;' href="<?php echo HTTP_CATALOG.substr($contact_person['file_url'],55); ?>" title="<?php echo $contact_person['file_name']; ?>" ><?php echo $contact_person['file_name']; ?></a><br />
                      <?php } ?>
                    <?php } ?>
                  </td>
                  <td class="text-center"><?php echo $customer['company_website']; ?></td>
                  <td class="text-center"><?php echo $customer['shareholder1_eng_name']; ?></td>
                  <td class="text-center"><?php echo $customer['shareholder1_chn_name']; ?></td>
                  <td class="text-center">
                    <?php if(!empty($customer['shareholder1_id'])){ ?>
                      <?php foreach($customer['shareholder1_id'] as $shareholder){ ?>
                        <a target='_blank' style='display: block;height: 100%;' href="<?php echo HTTP_CATALOG.substr($shareholder['file_url'],55); ?>" title="<?php echo $shareholder['file_name']; ?>" ><?php echo $shareholder['file_name']; ?></a><br />
                      <?php } ?>
                    <?php } ?>
                  </td>

                  <td class="text-center"><?php echo $customer['shareholder2_eng_name']; ?></td>
                  <td class="text-center"><?php echo $customer['shareholder2_chn_name']; ?></td>
                  <td class="text-center">
                    <?php if(!empty($customer['shareholder2_id'])){ ?>
                      <?php foreach($customer['shareholder2_id'] as $shareholder){ ?>
                        <a target='_blank' style='display: block;height: 100%;' href="<?php echo HTTP_CATALOG.substr($shareholder['file_url'],55); ?>" title="<?php echo $shareholder['file_name']; ?>" ><?php echo $shareholder['file_name']; ?></a><br />
                      <?php } ?>
                    <?php } ?>
                  </td>

                  <td class="text-center"><?php echo $customer['shareholder3_eng_name']; ?></td>
                  <td class="text-center"><?php echo $customer['shareholder3_chn_name']; ?></td>
                  <td class="text-center">
                    <?php if(!empty($customer['shareholder3_id'])){ ?>
                      <?php foreach($customer['shareholder3_id'] as $shareholder){ ?>
                        <a target='_blank' style='display: block;height: 100%;' href="<?php echo HTTP_CATALOG.substr($shareholder['file_url'],55); ?>" title="<?php echo $shareholder['file_name']; ?>" ><?php echo $shareholder['file_name']; ?></a><br />
                      <?php } ?>
                    <?php } ?>
                  </td>

                  <td class="text-center"><?php echo $customer['shareholder4_eng_name']; ?></td>
                  <td class="text-center"><?php echo $customer['shareholder4_chn_name']; ?></td>
                  <td class="text-center">
                    <?php if(!empty($customer['shareholder4_id'])){ ?>
                      <?php foreach($customer['shareholder4_id'] as $shareholder){ ?>
                        <a target='_blank' style='display: block;height: 100%;' href="<?php echo HTTP_CATALOG.substr($shareholder['file_url'],55); ?>" title="<?php echo $shareholder['file_name']; ?>" ><?php echo $shareholder['file_name']; ?></a><br />
                      <?php } ?>
                    <?php } ?>
                  </td>

                  <td class="text-center"><?php echo $customer['shareholder5_eng_name']; ?></td>
                  <td class="text-center"><?php echo $customer['shareholder5_chn_name']; ?></td>
                  <td class="text-center">
                    <?php if(!empty($customer['shareholder5_id'])){ ?>
                      <?php foreach($customer['shareholder5_id'] as $shareholder){ ?>
                        <a target='_blank' style='display: block;height: 100%;' href="<?php echo HTTP_CATALOG.substr($shareholder['file_url'],55); ?>" title="<?php echo $shareholder['file_name']; ?>" ><?php echo $shareholder['file_name']; ?></a><br />
                      <?php } ?>
                    <?php } ?>
                  </td>
                  <td class="text-center"><?php if($customer['status'] == 1){ echo $text_enabled; }else{ echo $text_disabled; } ?></td>

                  
                </tr>
                <?php } ?>
                <?php } else { ?>
                <tr>
                  <td class="text-center" colspan="4"><?php echo $text_no_results; ?></td>
                </tr>
                <?php } ?>
              </tbody>
              <tfoot style="background-color: #f5f5f5;font-weight: 700;">
                <tr>
                  <!-- <td class="text-center"><?php echo $column_action; ?></td> -->
                  <td class="text-center" >序號</td>
                  
                  <td class="text-center"><?php echo $column_company_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_company_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_tel; ?></td>
                  <td class="text-center"><?php echo $column_contact_person_email; ?></td>
<<<<<<< HEAD
<<<<<<< HEAD
                  <td class="text-center"><?php echo $column_company_address; ?></td>
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
                  <td class="text-center"><?php echo $column_contact_person_id; ?></td>
                  <td class="text-center"><?php echo $column_company_website; ?></td>
                  <td class="text-center"><?php echo $column_shareholder1_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder1_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder1_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder2_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder2_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder2_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder3_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder3_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder3_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder4_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder4_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder4_id; ?></td>
                  <td class="text-center"><?php echo $column_shareholder5_eng_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder5_chn_name; ?></td>
                  <td class="text-center"><?php echo $column_shareholder5_id; ?></td>
                  <td class="text-center"><?php echo $column_status; ?></td>
                </tr>
              </tfoot>
            </table>
          </div>
        </form>
        <div class="row">
          <div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
          <div class="col-sm-6 text-right"><?php echo $results; ?></div>
        </div>
      </div>
    </div>
  </div>
</div>
  <script type="text/javascript"><!--
$('#button-filter').on('click', function() {
  var url = 'index.php?route=project/project_customer&token=<?php echo $token; ?>';

  var filter_company_chn_name = $('input[name=\'filter_company_chn_name\']').val();

  if (filter_company_chn_name) {
    url += '&filter_company_chn_name=' + encodeURIComponent(filter_company_chn_name);
  }

  var filter_company_eng_name = $('input[name=\'filter_company_eng_name\']').val();

  if (filter_company_eng_name) {
    url += '&filter_company_eng_name=' + encodeURIComponent(filter_company_eng_name);
  }


  location = url;
});
//--></script>
<script type="text/javascript"><!--
$('input[name=\'filter_company_eng_name\']').autocomplete({
  'source': function(request, response) {
    $.ajax({
      url: 'index.php?route=project/project_customer/autocomplete&token=<?php echo $token; ?>&filter_company_eng_name=' +  encodeURIComponent(request),
      dataType: 'json',
      success: function(json) {
        response($.map(json, function(item) {
          return {
            label: item['company_eng_name'],
            value: item['company_eng_name']
          }
        }));
      }
    });
  },
  'select': function(item) {
    $('input[name=\'filter_company_eng_name\']').val(item['label']);
  }
});

$('input[name=\'filter_company_chn_name\']').autocomplete({
  'source': function(request, response) {
    $.ajax({
      url: 'index.php?route=project/project_customer/autocomplete&token=<?php echo $token; ?>&filter_company_chn_name=' +  encodeURIComponent(request),
      dataType: 'json',
      success: function(json) {
        response($.map(json, function(item) {
          return {
            label: item['company_chn_name'],
            value: item['company_chn_name']
          }
        }));
      }
    });
  },
  'select': function(item) {
    $('input[name=\'filter_company_chn_name\']').val(item['label']);
  }
});
//--></script>
<?php echo $footer; ?>